function insertGallery(editor){    
    var jvgalleryForm = $('jvgalleryForm');
    if(!jvgalleryForm) return false;
               
    var folder     = jvgalleryForm.folder.value.trim(); 
    if(folder ==''){ alert('Please select a folder');return false;}  
    var caption    = jvgalleryForm.caption.value.trim();
    var cols       = jvgalleryForm.cols.value.trim();
    var theme      = jvgalleryForm.theme.value.trim();
    var height     = jvgalleryForm.height.value.trim();
    var width      = jvgalleryForm.width.value.trim();
    
    var text = '';
    text += '{jvgallery';
    text += ' folder="'+folder+'"';
    text += ' theme="'+theme+'"';            
    text += ' height="'+height+'"';
    text += ' width="'+width+'"';
    text += ' cols="'+cols+'"';
    text += '}'+caption;
    text += "{/jvgallery}";
    
    jInsertEditorText(text, editor);
    
    SqueezeBox.listeners.close();
            
    return false;   
    
}
